package com.mq.rabbitmq.topic.demo2;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by Administrator on 2017/8/11.
 */
public class HelloSender {
    @Autowired
    private AmqpTemplate template;

    //测试发现topic.message的routekey不会走到topic.messages监听消息队列里面去，
    //因为默认的exchange 只会根据名字路由。
    public void send() {
        template.convertAndSend("topic.message","hello,rabbit~");
    }

    public void sendWithExchange(String content) {
        template.convertAndSend(ATopicRabbitConfig.exchange,"topic.message",content);
    }
}